package org.rency.crawler.integration.kafka;

import javax.validation.constraints.NotNull;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * 描述: ${TODO}<br>
 * 最近修改时间:2017/11/29 15:42<br>
 *
 * @author CaiyuRen
 * @version V1.0
 * @since 2017/11/29 15:42
 */
public class KafkaProperties {

  @NotNull(message = "服务地址不能为空")
  private String serverAddress;

  @NotNull(message = "服务端口不能为空")
  private int serverPort = 9092;

  @NotNull(message = "所属组不能为空")
  private String groupName;

  private boolean autoStartup = true;

  private boolean enableAutoCommit = true;

  private int autoCimmitIntervalMs = 100;

  private int sessionTimeoutMs = 6000;

  private int retryTimes = 0;

  private int batchSize = 16384;

  private int lingerMs = 1;

  private int bufferSize = 33554432;

  private int poolTimeout = 1000;

  private String autoOffsetReset = "earliest";

  private String producerType = "async";

  private String compressionType = "none";

  public String getServerAddress() {
    return serverAddress;
  }

  public void setServerAddress(String serverAddress) {
    this.serverAddress = serverAddress;
  }

  public int getServerPort() {
    return serverPort;
  }

  public void setServerPort(int serverPort) {
    this.serverPort = serverPort;
  }

  public String getGroupName() {
    return groupName;
  }

  public void setGroupName(String groupName) {
    this.groupName = groupName;
  }

  public boolean isAutoStartup() {
    return autoStartup;
  }

  public void setAutoStartup(boolean autoStartup) {
    this.autoStartup = autoStartup;
  }

  public boolean isEnableAutoCommit() {
    return enableAutoCommit;
  }

  public void setEnableAutoCommit(boolean enableAutoCommit) {
    this.enableAutoCommit = enableAutoCommit;
  }

  public int getAutoCimmitIntervalMs() {
    return autoCimmitIntervalMs;
  }

  public void setAutoCimmitIntervalMs(int autoCimmitIntervalMs) {
    this.autoCimmitIntervalMs = autoCimmitIntervalMs;
  }

  public int getSessionTimeoutMs() {
    return sessionTimeoutMs;
  }

  public void setSessionTimeoutMs(int sessionTimeoutMs) {
    this.sessionTimeoutMs = sessionTimeoutMs;
  }

  public int getRetryTimes() {
    return retryTimes;
  }

  public void setRetryTimes(int retryTimes) {
    this.retryTimes = retryTimes;
  }

  public int getBatchSize() {
    return batchSize;
  }

  public void setBatchSize(int batchSize) {
    this.batchSize = batchSize;
  }

  public int getLingerMs() {
    return lingerMs;
  }

  public void setLingerMs(int lingerMs) {
    this.lingerMs = lingerMs;
  }

  public int getBufferSize() {
    return bufferSize;
  }

  public void setBufferSize(int bufferSize) {
    this.bufferSize = bufferSize;
  }

  public int getPoolTimeout() {
    return poolTimeout;
  }

  public void setPoolTimeout(int poolTimeout) {
    this.poolTimeout = poolTimeout;
  }

  public String getAutoOffsetReset() {
    return autoOffsetReset;
  }

  public void setAutoOffsetReset(String autoOffsetReset) {
    this.autoOffsetReset = autoOffsetReset;
  }

  public String getProducerType() {
    return producerType;
  }

  public void setProducerType(String producerType) {
    this.producerType = producerType;
  }

  public String getCompressionType() {
    return compressionType;
  }

  public void setCompressionType(String compressionType) {
    this.compressionType = compressionType;
  }

  @Override
  public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
  }
}
